import java.math.BigInteger;


public class Loop implements Node{

	public String token = "<loop>";
	public Node cond;
	public Node stmt_seq;
			
	public Loop(){
		// the while token was skipped
		this.cond = new Cond();
		//System.out.println("TOKEN" + PSTree.Core_TK.getToken());
		int token = PSTree.Core_TK.getToken();
		if(token != 9){
			System.out.println("Error: expecting \"loop\" token");
			System.exit(1);
		}
		PSTree.Core_TK.skipToken(); // skip loop token
		this.stmt_seq = new Stmt_Seq();
		token = PSTree.Core_TK.getToken();
		//System.out.println("should be end token "+token);
		if(token != 3){
			System.out.println("Error: missing end token in loop statement");
			System.exit(1);
		}
		PSTree.Core_TK.skipToken(); // skip end token
		
	}

	@Override
	public void print(int indent) {
		System.out.print("while ");
		this.cond.print(indent);
		System.out.println("loop");
		this.stmt_seq.print(indent);
		PSTree.print_ind(indent-1);
		System.out.println("end;");
		
		
	}

	
	public void execute() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public BigInteger intexecute() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean compexecute() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public String Stringexcec() {
		// TODO Auto-generated method stub
		return null;
	}
}
